| Conditions | 3 |
| Total Lines | 17 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | 1 | /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ |
|
| 6 | |||
| 7 | function skypackResolver ({ modules, cdnHost = SKYPACK_CDN_HOST }: { modules: string[], cdnHost?: string }) { |
||
| 8 | 1 | const cache = new Map<string, string>() |
|
| 9 | |||
| 10 | 1 | return { |
|
| 11 | name: 'skypack-resolver', |
||
| 12 | async resolveId (id: string) { |
||
| 13 | 2 | if (modules.includes(id)) { |
|
| 14 | 1 | const version = await getVersion(this, cache, id) |
|
| 15 | |||
| 16 | return { |
||
| 17 | 1 | id: `${cdnHost}/${version}`, |
|
| 18 | external: true |
||
| 19 | 1 | } |
|
| 20 | } |
||
| 21 | } |
||
| 22 | } as Plugin |
||
| 23 | } |
||
| 27 |